import { defineStore } from 'pinia'
import { ref } from 'vue'
import { reqGetDictByDictCode } from '@/api/user'
import { DictArr } from '@/api/user/type'

const useDictStore = defineStore('dict', () => {
  // 证件类型
  let certificateType = ref([] as DictArr)
  // 获取证件类型
  const getCertificateType = async () => {
    const { data } = await reqGetDictByDictCode('CertificatesType')
    certificateType.value = data
    console.log(data, '---')
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve('ok')
      }, 4000)
    })
  }
  return {
    certificateType,
    getCertificateType
  }
})

export default useDictStore
